<html>
<head>
	  <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
	<script type="text/javascript">
	    var aJaxURL		= "server-side/main/main.action.php";
	    var aJaxURL1	= "server-side/main/main1.action.php";
	    var aJaxURL2	= "server-side/main/main2.action.php";		//server side folder url
		var tName		= "example";								//table name
		var fName		= "add-edit-form";							//form name											
		    	
		$(document).ready(function () {
			LoadTable();
		});
        
		function LoadTable(){
			var object_id	= $("#object_id").val();
	    	var status_id	= $("#status_id").val();
	    	
	    	GetButtons("", "","fillter");	
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable(tName, aJaxURL, "get_list", 8, "object_id=" + object_id + "&status_id=" + status_id, 0, "", 1, "desc");
			//setTimeout(LoadTable, 4000);

		}
		function LoadDialog(){
			var id		= $("#mac").val();
			var buttons = {	
					"close_screen": {
			            text: '',
			            id: "close_screen"
			        },
					"refresh_dialog": {
			            text: "განახლება",
			            id: "refresh_dialog"
			        }, 
			        "cancel": {
			            text: "დახურვა",
			            id: "cancel-dialog",
			            click: function () {
			            	$(this).dialog("close");
			            }
			        },
					
		        };
			
			/* Dialog Form Selector Name, Buttons Array */
			GetDialog("object_dialog", 1070, "auto", buttons);
		}

		function LoadDialog1(fName,ip, status){
			
			parame 				= new Object();
			parame.act 			= 'get_edit_page1';
			
			parame.ip     = ip;
			parame.status = status;
			
			$.ajax({
		        url: aJaxURL,
			    data: parame,
		        success: function(data) {		        	
		        	
		        var buttons = {
			 						"save": {
			 				            text: "შენახვა",
			 				            id: "save-dialog2"
			 				        }, 
			 			        	"cancel": {
			 				            text: "დახურვა",
			 				            id: "cancel-dialog",
			 				            click: function () {
			 				            	$(this).dialog("close");
			 				            }
			 				        }
	 			        		};
	        	
	        	GetDialog("add-edit-form", 970, "auto", buttons);
	        	$("#add-edit-form").html(data.page);
	        	
				/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
				GetDataTable("example_object", aJaxURL1, "get_list", 10, "ip=" + ip + "&status=" +status, 0, "", 1, "desc");
				SetEvents("", "", "", "example_object", "object_dialog", aJaxURL1);
				 }
		    });
		}
		
		$(document).on("click", "#close_screen", function () {
			param 	  = new Object();
			param.act ="close_screen";

			param.id  = $("#mac").val();
    	
		    $.ajax({
		        url: aJaxURL1,
			    data: param,
		        success: function(data) {			        
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							alert(data.error);
						}else{
							$("#object_dialog").html(data.page);
							$("#close_screen").html('<span class="ui-button-text">'+data.button_name+'</span>');
						}
					}
			    }
		    });
		});

		$(document).on("click", "#refresh_dialog", function () {
			param 	  			 = new Object();
			param.act 			 = "close_screen";

			param.id			 = $("#mac").val();
			param.refresh_dialog = 'refresh_dialog';
    	
		    $.ajax({
		        url: aJaxURL1,
			    data: param,
		        success: function(data) {			        
					if(typeof(data.error) != 'undefined'){
						if(data.error != ''){
							alert(data.error);
						}else{
							$("#object_dialog").html(data.page);
							$("#close_screen").html('<span class="ui-button-text">'+data.button_name+'</span>');
						}
					}
			    }
		    });
		});

		$(document).on("click", "#fillter", function () {
	    	LoadTable();
	    });
	   
    </script>
</head>

<body>
    <div id="dt_example" class="ex_highlight_row" style="width: 75%; margin: 0 auto;">
        <div id="container" style="width: 99%;">        	
            <div id="dynamic">
            	<h2 align="center">მონიტორინგი</h2>
             	<div id="button_area">
         			<div class="left" style="width: 195px;">
	         		 <label for="search_end" class="left" style="margin:-18px 0 0 28px">ფილიალები</label>
			          <select style="width: 186px;" id="object_id" class="inpt right">
			          <?php $rResult = mysql_query("SELECT `ip`,`object_name`
													FROM  `object`
													WHERE  actived=1");

								echo'<option value="0" selected="selected">ყველა</option>';
								while ( $aRow = mysql_fetch_array( $rResult ) ){

							    	echo '<option value="'.$aRow[0].'">'.$aRow[1].'</option>';
								}
					 ?>
					</select>
	             </div>
	             <div class="left" style="width: 195px;">
	         		 <label for="search_end" class="left" style="margin:-17px 0 0 13px">კომპიუტერის მდგომარეობა</label>
			          <select style="width: 186px;" id="status_id" class="inpt right">
			          <?php $rResult = mysql_query("	SELECT `id`,`status`
														FROM `status`
														WHERE actived=1");

								echo'<option value="0" selected="selected">ყველა</option>';
								while ( $aRow = mysql_fetch_array( $rResult ) ){

							    	echo '<option value="'.$aRow[0].'">'.$aRow[1].'</option>';
								}
					 ?>
					</select>
	             </div>
	             <div class="left" style="">
	            		<button id="fillter" style="width: 90px; margin-left: 15px; height: 26px;">ფილტრი</button>
	            	</div>
        		</div>
                <table class="display" id="example">
                    <thead >
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 100%;">ფილიალი</th>
                            <th style="width: 120px;">კომპ.რაოდ.</th>
                            <th style="width: 120px;">მოქმედი</th>
                            <th style="width: 120px;">უმოქმედო</th>
                            <th style="width: 100px;">დრო</th>
                            <th style="width: 120px;">გამორთული</th>
                            <th style="width: 100px;">დრო</th>
                           
                        	
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 95px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 105px;"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" style="width: 80px;"/>
                            </th>
                            
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
    <!-- jQuery Dialog -->
    <div id="add-edit-form" class="form-dialog" title="სკრინშოტი">
    	<!-- aJax -->
	</div>
	 <div id="object_dialog" class="form-dialog" title="სკრინშოტი">
    	<!-- aJax -->
	</div>
</body>
</html>






